package com.lins.framework.http.util;

/**
 * Created by Admin on 2017/3/14.
 */

public class ApiException extends RuntimeException {


    public ApiException(int status) {
        super(getApiExcepitionMsg(status));
    }

    public ApiException(String detailMsg) {
        super(detailMsg);
    }

    /**
     * 由于服务器传递过来的错误信息直接给用户看的话，用户未必能够理解
     * 需要根据错误码对错误信息进行一个转换，在显示给用户
     *
     * @param status
     * @return
     */
    private static String getApiExcepitionMsg(int status) {
        String msg = "";
        switch (status) {
            case 36001:
                msg = "登录超时";
                break;
        }
        return msg;
    }

}
